package com.travel.controller;

import com.qianfeng.util.ResultMsg;
import com.travel.entity.TbView;
import com.travel.service.ViewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/adminView")
public class AdminViewController {
    @Autowired
    ViewService viewService;

    //分页查询所有的景点
    @GetMapping("/selectAll")
    public ResultMsg findAll(@RequestParam(required = false,defaultValue = "1") int current, @RequestParam(required = false,defaultValue = "1") int size){
        return viewService.findAll(current, size);
    }
    //添加一个景点
    @PostMapping("/addone")
    public ResultMsg addOne(TbView tbView){
        return viewService.addOne(tbView);
    }

    //删除一个景点
    @GetMapping("/deleteOne")
    public ResultMsg deleteOne(Integer viewId) {
        return viewService.deleteOne(viewId);
    }
    //修改一个景点信息
    @PostMapping("updateOne")
    public ResultMsg updateOne(TbView tbView){
        return viewService.updateOne(tbView);
    }
}
